import request from '@/router/axios';

export const bomList = (current, size, params) => {
  return request({
    url: '/api/prdbomsap/page',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}

//新增产品bom
export const bomAdd = (data) => {
  return request({
    url: '/api/prdbomsap/save',
    method: 'post',
    data: data
  })
}

//编辑产品bom
export const bomUpdate = (data) => {
  return request({
    url: '/api/prdbomsap/update',
    method: 'post',
    data: data
  })
}


// 删除产品bom
export const bomRemove = (ids) => {
  return request({
    url: '/api/prdbomsap/remove',
    method: 'post',
    params: {
      ids
    }
  })
}

//获取产品详情
export const bomDetail = (id) => {
  return request({
    url: '/api/prdbomsap/detail',
    method: 'get',
    params: {
      id
    }
  })
}

//产品BOM列表
export const productBomList = (productNo) => {
  return request({
    url: '/api/prdbomsap/bomTreeByPrdNo',
    method: 'get',
    params: {
      productNo
    }
  })
}

//所有有BOM的产品列表
export const bomproductList = (params) => {
  return request({
    url: '/api/prdinfo/bomPrdSelected',
    method: 'get',
    params: {
      ...params
    }
  })
}

//获取物料类型
export const getMaterialTypeTree = (params) => {
  return request({
    url: '/api/materialinfo/getTree',
    method: 'get',
    params: {
      ...params
    }
  })
}

//根据物料类型和物料组获取物料下拉选
export const materialList = (params) => {
  return request({
    url: '/api/prdinfo/materialByTypeAndGroup',
    method: 'get',
    params: {
      ...params
    }
  })
}
